/**
 * (created at 2011-2-9)
 */
package qiushuo.mysqlparser.ast.fragment.tableref;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import qiushuo.mysqlparser.generator.SQLType;

/**
 * @author <a href="mailto:QiuShuo1985@gmail.com">QIU Shuo</a>
 */
public class TableRefFactor implements TableReference {
    /** e.g. <code>"`db2`.`tb1`"</code> is possible */
    private final String tableName;
    private final String alias;
    private final List<IndexHint> hintList;

    public TableRefFactor(String tableName, String alias, List<IndexHint> hintList) {
        super();
        this.tableName = tableName;
        this.alias = alias;
        if (hintList == null || hintList.isEmpty()) {
            this.hintList = Collections.emptyList();
        } else if (hintList instanceof ArrayList) {
            this.hintList = hintList;
        } else {
            this.hintList = new ArrayList<IndexHint>(hintList);
        }
    }

    public TableRefFactor(String tableName, List<IndexHint> hintList) {
        this(tableName, null, hintList);
    }

    @Override
    public String generateSql(SQLType type) {
        // QS_TODO gen sql
        throw new UnsupportedOperationException("not implemented yet");
    }

}
